package com.jk.mapper;

import com.jk.utile.UserDynaSqlProvider;
import com.jk.vo.UserInfo;
import com.jk.vo.UserLoginLog;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;

public interface LogAndRegMapper {
    @SelectProvider(type=UserDynaSqlProvider.class,
            method="checkNumberOrId")
    int checkNumberOrId(UserInfo user);


    //
    @Select(" SELECT user_id as userId,user_type as userType,user_status as userStatus" +
            "            FROM user_login" +
            "            WHERE user_number=#{userNumber} AND user_pwd=#{userPwd}")
    UserInfo checkNumberAndPwd(UserInfo user);


    //削去 联查
    @Select(" SELECT COUNT(1)" +
            "            FROM user_login_log " +
            "            WHERE log_login_ip=#{logLoginIp} AND log_user_id=#{logUserId}")
    int checkIp(UserLoginLog userLog);


    @Insert("insert into user_login (user_id, user_number, user_pwd,user_type) values " +
            "(#{userId},#{userNumber},#{userPwd},#{userType})")
    int insertUser(UserInfo user);
}
